package demo4;

public class Animal {
    public int age;
    public String name;
    static{
        System.out.println("执行了父类的静态代码块");
    }
    {
        System.out.println("执行了父类的实例代码块");
    }

    public Animal(int age, String name) {
        this.age = age;
        this.name = name;
        System.out.println("执行了父类的构造方法");
    }

    public void sleep(){
        System.out.println(this.name + "在睡觉");
    }
}
